home *** CD-ROM | disk | FTP | other *** search
- Path: news.larc.nasa.gov!amiga-request
- From: amiga-request@ab20.larc.nasa.gov (Amiga Sources/Binaries Moderator)
- Subject: v91i172: ED3 1.1 - a primitive 3D editor for use with NU3, Part01/06
- Reply-To: rodent@netcom.com (Ben Discoe)
- Newsgroups: comp.sources.amiga
- Message-ID: <comp.sources.amiga.v91i172@ab20.larc.nasa.gov>
- Date: 07 Nov 91 15:54:08 GMT
- Approved: tadguy@uunet.UU.NET (Tad Guy)
- X-Mail-Submissions-To: amiga@uunet.uu.net
- X-Post-Discussions-To: comp.sys.amiga.misc
-
- Submitted-by: rodent@netcom.com (Ben Discoe)
- Posting-number: Volume 91, Issue 172
- Archive-name: utilities/ed3-1.1/part01
-
- ED3, a primitive 3D editor for use with NU3, a primitive 3D viewer.
- This is version 1.1, the 1st real release. There is a lot of work left to do.
-
- The main purpose of this program is to play with polyhedra and "geodesic"
- structures. However, it is very general-purpose so you could use it for any
- sort of 3D world-design.
-
- #!/bin/sh
- # This is a shell archive. Remove anything before this line, then unpack
- # it by saving it into a file and typing "sh file". To overwrite existing
- # files, type "sh file -c". You can also feed this as standard input via
- # unshar, or by typing "sh <file", e.g.. If this archive is complete, you
- # will see the following message at the end:
- # "End of archive 1 (of 6)."
- # Contents: create.p ed3.h ed3.readme ed3.tech eded.p edgr.p edio.p
- # edsysdef.h edtypes.h edvan.p freq.p sysdefed.h sysgr.h sysgr.p
- # sysnogr.h undo.p
- # Wrapped by tadguy@ab20 on Thu Nov 7 10:53:51 1991
- PATH=/bin:/usr/bin:/usr/ucb ; export PATH
- if test -f 'create.p' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'create.p'\"
- else
- echo shar: Extracting \"'create.p'\" \(471 characters\)
- sed "s/^X//" >'create.p' <<'END_OF_FILE'
- X/* Prototypes for functions defined in create.c */
- Xvoid create_poly(int which_poly);
- Xvoid create_tetra(int connected);
- Xvoid create_octa(int connected);
- Xvoid create_cube(int connected);
- Xvoid create_icosa(int connected);
- Xvoid create_dodec(int connected);
- Xvoid create_rhombic(int connected);
- Xvoid create_cuboct(int connected);
- Xvoid create_globe(void);
- Xvoid create_globe0(coord radius,
- X int phi_div,
- X int theta_div);
- Xvoid normalize(void);
- END_OF_FILE
- if test 471 -ne `wc -c <'create.p'`; then
- echo shar: \"'create.p'\" unpacked with wrong size!
- fi
- # end of 'create.p'
- fi
- if test -f 'ed3.h' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'ed3.h'\"
- else
- echo shar: Extracting \"'ed3.h'\" \(6803 characters\)
- sed "s/^X//" >'ed3.h' <<'END_OF_FILE'
- X/*
- X Include file for all modules of the 3d editor.
- X Important global stuff.
- X
- X09-02-91 added pselected, ploose
- X08-28-91 added MAX_EDGES
- X08-24-91 moved Gadget IDs to edgr.c
- X08-23-91 moved Menu IDs to sysgr.c
- X moved many flags into a new "Flags" structure
- X*/
- X
- X#define INTEGER 1
- X
- X#define MAX_EDGES 20 /* The most edges any polygon is allowed to have */
- X#define OPERATIONS 100 /* max */
- X#define ACTIONBUF 300 /* action buffer size */
- X#define REFRESH_LEVEL 100 /* If there are less then REFRESH_LEVEL facets on
- Xthe screen, undo, redo and and move_points will do a full refresh to keep the
- Xdisplay clean. Obviously we don't ALWAYS want to do a full refresh if the
- Xobject has many hundreds of facets */
- X
- X#include "sysdefed.h" /* system-specific definitions */
- X#include "edtypes.h" /* typedefs */
- X
- X#if PROTOS
- X#include "create.p" /* include prototypes */
- X#include "edgr.p"
- X#include "eded.p"
- X#include "sysgr.p"
- X#include "edio.p"
- X#include "edvan.p"
- X#include "freq.p"
- X#include "undo.p"
- X#endif
- X
- X#define FILE_EXT ".3d"
- X#define GADX 90 /* width of gadget boxes */
- X#define edit_minx GADX+1 /* bounds of editing area */
- X/* edit_miny is a variable based on the size of the title bar */
- X
- X/* gadget IDs */
- X#define GID_ADD 1
- X#define GID_DELETE 2
- X#define GID_SELECTOR 3
- X#define GID_MOVE 4
- X#define GID_FACE 5
- X#define GID_POLY 6
- X#define GID_MORE 7
- X#define GID_DEFACE 8
- X#define GID_DEPOLY 9
- X#define GID_MORE2 10
- X#define GID_ROTATE 11
- X#define GID_ROTP 12
- X#define GID_ZOOM 13
- X#define GID_DIST 14
- X#define GID_GLUE 15
- X#define GID_UNDO 16
- X#define GID_REDO 17
- X#define GID_XY 18
- X#define GID_XZ 19
- X#define GID_ZY 20
- X#define GID_3D 21
- X#define GID_color1 22
- X#define GID_color2 23
- X#define GID_color3 24
- X
- X/* editing modes */
- X#define M_ADDP 0 /* add point */
- X#define M_DELP 1 /* delete point */
- X#define M_SELE 2 /* select/deselect points */
- X#define M_MOVP 3 /* move point */
- X#define M_FACE 4 /* start a new face */
- X#define M_POLY 5 /* start a new face */
- X#define M_MORE 6 /* designate another point of the face or poly to create */
- X#define M_DEFA 7 /* remove a face */
- X#define M_DEPO 8 /* remove a poly */
- X#define M_KMORE 9 /* designate another point of the face or poly to remove */
- X#define M_ROTA 10 /* rotate around third dimension: place axis */
- X#define M_ROTP 11 /* rotate around third dimension: move the points */
- X#define M_ZOOM 12 /* zoom in/out */
- X#define M_DIST 13 /* adjust distance tool */
- X#define M_GLUE 14 /* glue two points together (fuse into one point) */
- X
- X/* display modes */
- X#define DM_XY 0 /* three 2D display modes */
- X#define DM_XZ 1
- X#define DM_ZY 2
- X#define DM_3D 3 /* 3D view mode, unimplemented */
- X
- X/* Toggleable menu item numbers */
- X#define MI_ASSUME_POLY 0
- X#define MI_COORDS 1
- X#define MI_CROSSHAIR 2
- X#define MI_DISTANCETOOL 3
- X#define MI_ROTATEALL 4
- X#define MI_UNDOBUF 5
- X#define MI_UNDOBUFSIZE 6
- X
- X/* error codes */
- X#define OKAY 0
- X#define ERR_NOTHING 1 /* nothing was there */
- X#define ERR_CANTOPEN 2 /* can't open a file */
- X#define ERR_NOTED3 3 /* not an ED3 file */
- X#define ERR_NOMEM 4 /* not enough memory for operation */
- X#define ERR_NOMEM_POINT 5 /* not enough memory for more points */
- X#define ERR_NOMEM_FACE 6 /* not enough memory for more faces */
- X#define ERR_NOMEM_POLY 7 /* not enough memory for more polygons */
- X#define ERR_BADFACE 8 /* face refers to a non-existent point */
- X#define ERR_SYS 9
- X#define ERRORS 10
- X
- X/* Menu options */
- X#define MO_NOTENABLED 1
- X#define MO_TOGGLE 2 /* allow user to toggle w/checkmark */
- X#define MO_CHECKED 4 /* checked at creation time */
- X
- X/* Gadget flags */
- X#define GF_NOSELECT 1 /* this gadget should not be selectable */
- X
- X/* display flags */
- X#define DF_WORKBENCH 1
- X#define DF_MED_RES 2
- X#define DF_SYS_PALETTE 4 /* use the system (in this case workbench) palette */
- X
- X/* mouse flags */
- X#define MF_DOUBLE 2
- X#define MF_SHIFTED 4
- X
- X/* action types */
- X#define AT_ADD_P 1 /* add point */
- X#define AT_DEL_P 2 /* del point */
- X#define AT_ADD_F 3 /* add face */
- X#define AT_DEL_F 4 /* del face */
- X#define AT_ADD_Q 5 /* add polygon */
- X#define AT_DEL_Q 6 /* del polygon */
- X#define AT_MOVE_P 7 /* move point */
- X#define AT_JOIN_P 8 /* join two points (replace one with another) */
- X#define AT_DEL_V 9 /* delete vertex */
- X#define AT_MORPH_Q 10 /* degenerate a polygon into a face */
- X
- X/* polyhedron numbers */
- X#define POLY_TET 0
- X#define POLY_OCT 1
- X#define POLY_CUBE 2
- X#define POLY_ICOS 3
- X#define POLY_DODEC 4
- X#define POLY_RHOMB 5
- X#define POLY_CUBOCT 6
- X
- X/* point flags: in the code field of EdPoint (below) */
- X#define PF_LOOSE (1 << 14)
- X#define PF_SELECTED (1 << 15)
- X#define PF_CLIP 0x000f /* low four bits used for clipping info */
- X
- X#define EV_HITBUTTON 1 /* pressed a boolean gadget */
- X#define EV_HITRETURN 2 /* hit return in a long_int gadget */
- X#define EV_CHECKINT 3
- X#define EV_CANCEL 4 /* like, if the user closes the window */
- X
- X/* point macros */
- X#define pselected(p) (point[p].code & PF_SELECTED)
- X#define ploose(p) (point[p].code & PF_LOOSE)
- X#define off_screen(p) (point[p].code & PF_CLIP)
- X
- X/* an unused value returned by ShowGetLong to signal cancellation */
- X#define SGL_CANCEL -69696969 /* orgy */
- X
- X#ifdef DEFINE_GLOBALS
- X# define vextern
- X#else
- X# define vextern extern
- X#endif
- X
- X/******* global variables *******/
- X
- X/* pointers to the complete set of 3D points and faces */
- Xvextern EdPoint *point;
- Xvextern Face *face;
- Xvextern Polygon *poly;
- Xvextern EndPoint dtool_end[2]; /* the ends of the distance tool line segment */
- Xvextern Flags flags;
- Xvextern Colors colors;
- X
- Xvextern short *select_p; /* array of selected points */
- X
- X/* temporary: remember the points when creating a new polygon */
- Xvextern unsigned short temp_poly[20];
- X
- Xvextern unsigned short MAX_POINTS, MAX_FACES, MAX_SELECT, MAX_POLYS;
- Xvextern unsigned short points, faces, polys, selected;
- Xvextern unsigned short new_seg, first_point, last_point;
- X
- Xvextern Point3D axis; /* point around which we rotate */
- Xvextern Point3D point0; /* always 0 */
- Xvextern Vector3D movement; /* the direction we drag the points */
- Xvextern Vector3D offset; /* current viewing offset */
- Xvextern Vector3D vector0; /* always 0 */
- X
- X/* Please Forgive Me for Using Short Names for some Global Variables */
- X
- Xvextern coord gx, gy, gz; /* global 3d cursor location */
- Xvextern short px, py,
- X mx, my; /* mouse location on screen */
- Xvextern char mode, /* editing mode */
- X dmode; /* display mode (XZ etc.)play mode (XZ etc. */
- X
- Xvextern short sxmax, symax; /* flexible size of drawing area */
- Xvextern short x_center, y_center;
- Xvextern short edit_miny;
- X
- Xvextern double rot_angle;
- Xvextern double SCALE, distance;
- X
- Xvextern char title[80]; /* the message on the screen's title bar*/
- Xextern char *errstring[];
- X
- Xvextern action_bufsize, act_buf; /* in-use vs. next time */
- Xvextern operation_bufsize, op_buf;
- X
- Xvextern Operation *operation;
- Xvextern char *action;
- X
- Xvextern changes; /* number of operations given since last save */
- END_OF_FILE
- if test 6803 -ne `wc -c <'ed3.h'`; then
- echo shar: \"'ed3.h'\" unpacked with wrong size!
- fi
- # end of 'ed3.h'
- fi
- if test -f 'ed3.readme' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'ed3.readme'\"
- else
- echo shar: Extracting \"'ed3.readme'\" \(9555 characters\)
- sed "s/^X//" >'ed3.readme' <<'END_OF_FILE'
- X
- X-------------------------------------------------------------------
- XED3, a primitive 3D editor for use with NU3, a primitive 3D viewer.
- X-------------------------------------------------------------------
- X
- XThis is version 1.1, the 1st real release. There is a lot of work left to do.
- XThis version is placed in the public domain by it's author, Ben Discoe.
- XThe author is a firm believer in the hacker ethic. Use at your own risk. If
- Xyou like this program, use it, use pieces of its code, or even find it
- Xvaguely interesting, please let me know!
- X
- XThe main purpose of this program is to play with polyhedra and "geodesic"
- Xstructures. However, it is very general-purpose so you could use it for any
- Xsort of 3D world-design. The only other 3D editor I have ever used is the
- Xone in Sculpt-3D (back in 1987) so I don't know how they might compare to
- Xed3. The files that ed3 loads and saves are not in any standard format,
- Xso you can't just load Sculpt, Imagine or Turbo Silver objects.
- X
- Xed3 can compile into a integer version or a floating-point version. The
- Xfloating-point version is highly recommended for people with fast CPUs,
- Xmath coprocessors, or the need for high accuracy.
- X
- XBefore running: make sure you have the req.library in your LIBS:
- Xdirectory. It's included in this archive case you don't have it already.
- X
- XThere's only one command line option: -w will start ed3 on your workbench
- Xscreen. Sorry, Workbench fans, no ToolTypes stuff.
- X
- XI've just realized that the program has developed completely lacking
- Xdocumentation, so I'll now make a doomed attempt to at least notify you of
- Xwhat features are available:
- X
- X*****************************************************************************
- X
- X G A D G E T S
- X
- XADD Puts you in Add Point mode. Click either button to add points.
- X
- XDELETE Puts you in Delete Point mode. Click to delete points - which
- X button you use affects things - see below.
- X
- XSELECTOR This gives you the selector tool, which selects/deselects points.
- X Double-click to select-connected (or deselect-connected).
- X
- XMOVE Puts you in Move mode. Click to select a point, shift-click to
- X select more points. Once the points are selected, you can drag
- X to move them.
- X
- XFACE Puts you in Add Face mode. A Face in ED3 means a triangular face.
- X In this mode, click on any three points to create a Face.
- X
- XPOLY Puts you in Add Polygon mode. A Polygon in ED3 means a polygon
- X with more than 3 vertices. This distinction between Faces and
- X Polygons is important to programs that, for example, only
- X support planar faces.
- X
- X(ADDP) You are put in this mode when connecting points for a Face or
- X Polygon.
- X
- XDEFACE Lets you specify three points to remove a Face.
- X
- XDEFACE Lets you specify N points to remove a Poly.
- X
- XROTATE In Rotate mode, click once to specify the axis of rotation,
- X then move the mouse around this point to the desired angle
- X and click once more. All points will rotate.
- X
- XZOOM Lets you change the degree of magnification. In Zoom mode, click
- X the first button to zoom in towards a location, second button to
- X zoom out away from a location. Try it, it's one of my favorite
- X features.
- X
- XDISTANCE The Distance tool is a "ruler" for measuring distance in 3D space.
- X Both ends can be dragged around, or "attached" to points by
- X double-clicking near the intended point. The distance (length
- X of the distance tool) appears in the upper right corner.
- X
- XGLUE Glue will "merge" the the point closest to the pointer and the
- X point closest to it. All degenerations are handled correctly.
- X
- XUNDO If you find a bug in Undo/Redo, let me know. It's a fairly
- XREDO tricky feature. It's also fairly uncommon in 3d editors.
- X
- XXY, XZ, YZ Specify the orthogonal direction of view.
- X
- X> 3D < Currently, viewing your object from a 3D perspective requires
- X a separate program, NU3, which supports several different
- X hidden-line algorithms. Someday this capability may merge
- X with ED3.
- X
- XCOLOR gadgets. These affect the color of the faces you define which is
- X only displayed by the 3D viewer NU3.
- X
- X*****************************************************************************
- X
- X M E N U S
- X
- XSince the right button is used to select points, the pointer must be over
- Xthe menu bar to access the menus.
- XMenu options:
- X
- XPROJECT Normal stuff. "Save Defaults" saves the settings of the "Options"
- X menu to a file called ed3-defs, which is automatically loaded the
- Xnext time you start.
- X
- XEDIT No clipboard support yet. The Duplicate menu makes an exact in-place
- X copy of all selected points and the facets connecting them. Erase
- Xkills the selected points and the facets connecting them. The bottom three
- Xoptions aren't completely implemented.
- X
- XPOLYHEDRA These are some basic polyhedra. You can use them as
- X starting points for constructing really wild, complex
- Xpolyhedra using the special features described below.
- X
- XSPECIAL
- X-------
- XFREQUENCY This is one of the two Really Neat features of ED3.
- X This will divide each triangular (or quadrilateral) face into
- Xa set of smaller triangles, where the number of resultant triangles is
- Xfrequency squared. Try this on your favorite polyhedra, then Normalize to
- Xget pseudo-geodesic structures. The reason why I say psuedo is because if
- Xyou use this method with any ODD frequency, the resulting location of
- Xvertices does not truly correlate to subdiving the geodesicic arcs described
- Xby the polyhefron edges. It is, however, very close, close enough for a
- Xcrude program such as ED3. You could theoretically raise a form to any large
- Xfrequency, although you are, naturally, limited by your memory size.
- X
- XFIND DUAL This is the second Really Neat feature.
- X Every fully-connected polyhedron has a dual, which is formed
- Xby exchanging the configuration of faces with vertices. For example, the
- Xcube's dual is the octahedron, and the icosahedron's dual is the pentagon
- Xdodecahedon. Complex geodesic structures also have their duals, which are
- Xtypically complex "fly's eye" structures involving many hexagons. Naturally,
- Xa dual of a dual is the original shape.
- X
- XUNFOLD This is a future Really Neat feature.
- X
- XNORMALIZE This finds the center of all points and adjusts all points
- X to lie the average distance from that center. Simply stated,
- Xit makes all points Spherical. Use to project flat tesselated faces onto
- Xtheir geodesics.
- X
- XSTELLATE This will take every face and make a pyramid out of it,
- X giving a "3D star" based on whatever shape you are using.
- XCombining this feature with "Find Dual" can be used to form truncated forms
- Xof polyhedra. Try it.
- X
- XCENTER->ORIGIN Moves all points so that their vector sum is centered on the
- X origin.
- X
- XOPTIONS
- X-------
- XASSUME POLYHEDRON tell the features on the Special menu (notably Find Dual
- X and Normalize) to assume that the shape you're working with
- X is a polyhedron. Set this option whenever you DO have a
- X polyhedron.
- X
- XROTATE EVERYTHING tells the rotate command to rotate all points, not only
- X the selected points.
- X
- XUNDO BUFFER ACTIVE turns the undo/redo buffer on or off. If you playing with
- X very large shapes or have little memory, you may want to
- X turn this off.
- X
- XSET UNDO BUFFER SIZE will affect the undo buffer only at the next time you
- X start ed3 - it doesn't change or damage your current undo
- X buffer.
- X
- X
- X(A 3D CONVEX HULL algorithm is yet another future Really Neat feature)
- X
- X*****************************************************************************
- X
- XMore functionality available from the keyboard:
- X
- X ESC Quits.
- X C Toggles the crosshair.
- X D Toggles the distance tool.
- X M Same as the Move button.
- X U Same as Undo button.
- X R Same as Redo button.
- X8 and 2 The ED3 "pointer" really exists in 3 dimensions, as its location is
- X displayed near the title bar. 8 and 2 (chosen for their location in
- X the keypad) move the pointer "far" and "near", in whatever direction
- X isn't available using the mouse.
- XSHIFT Used to multiple-select points (just like a GUI should) in MOVE mode.
- XSPACE BAR This is a commonly used key! Since your structure can get
- X very large, you may not want to refresh the screen after every
- X operation, especially on a 68000 machine. Therefore, redraw is
- X triggered by the space bar so it occurs only when you want it to.
- X
- X*****************************************************************************
- X
- XOn the use of the Left and Right Mouse Buttons to select points:
- X
- XLEFT button will select the point closest to the pointer ON THE SCREEN,
- XRIGHT button will select the point closest IN 3D SPACE to the 3D location of
- X the ED3 pointer. This is tricky to use, but essential when you've
- X got lots of points that are othogonal to the 3D axes, making the Left
- X button unreliable. I typically Rotate the structure instead, giving
- X each point a unique mapping onto the screen, then use the left
- X button.
- X
- X*****************************************************************************
- X
- XAbout the Author
- X----------------
- X I dropped out of Caltech for two reasons. First, my brain fried on the
- XQuantum Physics and EE (i'm a programmer, not a physicist). Second, I was
- Xspending too much time with my hobby, 3D geometry, which no one was
- Xinterested in teaching me about. ED3 and NU3 were projects that evolved out
- Xof this hobby and were written casually during a few months of unemployment
- Xin Berkeley in early summer 1990. I recently revived them, added a ton
- Xof stuff, and released 1.0.
- X
- X I am currently (10/17/91) employed (and reachable) at
- X
- Xpreferably: rodent@netcom.com (a public-access site)
- X
- XBen Discoe
- XVersasoft Corp.
- X4340 Almaden Expr. #110
- XSan Jose, CA 95118
- X
- XRead ED3.tech (and the source) for technical notes.
- X
- END_OF_FILE
- if test 9555 -ne `wc -c <'ed3.readme'`; then
- echo shar: \"'ed3.readme'\" unpacked with wrong size!
- fi
- # end of 'ed3.readme'
- fi
- if test -f 'ed3.tech' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'ed3.tech'\"
- else
- echo shar: Extracting \"'ed3.tech'\" \(1599 characters\)
- sed "s/^X//" >'ed3.tech' <<'END_OF_FILE'
- X
- XED3, a primitive 3D editor for use with NU3, a primitive 3D viewer.
- X*******************************************************************
- X
- XThis is version 1.1. There is a lot of work left to do.
- XThe program may crash, however it's not likely even if you're TRYING to crash.
- X
- Xed3 was developed with both Lattice and Aztec at different times, so it
- Xshouldn't matter which you use. It wants the 2.0 header files, however, to
- Xtake advanced of 2.0 when it is present.
- X
- XHere are some technical matters you may be wondering about, to save you from
- Xhaving to slog through the source:
- X
- XED3 allocates room for points, faces, and polys dynamically, so structures
- Xare limited only by available ram.
- X
- XED3 does its own line clipping, which should be very stable unless you REALLY
- Xzoom in far.
- X
- XThe file format isn't anything standard, but rather a simple text format.
- XI'd like to change this, but there is no obvious standard (or more precisely,
- Xtoo many standards!). If anyone knows of some nicely documented appropriate
- Xstandard, please let me know.
- X
- XThe undo/redo feature uses two circular buffers, one for operations and one
- Xfor the individual actions.
- X
- XThings needed:
- X
- X 0. The "unfold" operation should show possible "unwrappings" of polyhedra,
- X much like the Dymaxion map is an "unfolded" icosahedron. This is
- X to experiment with novel ways of mapping spheres flatly.
- X 1. A Find-the-Convex Hull feature is needed. The geometric algorithms
- X involved are a bit hairy, but I've managed to find code that should
- X work once I find time to figure it out.
- X 2. Some kind of portable/importable file format.
- X
- END_OF_FILE
- if test 1599 -ne `wc -c <'ed3.tech'`; then
- echo shar: \"'ed3.tech'\" unpacked with wrong size!
- fi
- # end of 'ed3.tech'
- fi
- if test -f 'eded.p' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'eded.p'\"
- else
- echo shar: Extracting \"'eded.p'\" \(2920 characters\)
- sed "s/^X//" >'eded.p' <<'END_OF_FILE'
- X/* Prototypes for functions defined in eded.c */
- Xvoid main(int argc,
- X char **argv);
- Xvoid del_selected(void);
- Xvoid del_selected_points(int assume_loose);
- Xvoid del_point(index p,
- X int assume_loose,
- X int silent);
- Xvoid convert_to_xyz(pixel pixx,
- X pixel pixy);
- Xvoid convert_to_xy(coord x,
- X coord y,
- X coord z);
- Xvoid convert_points(void);
- Xvoid convert_point(register uindex p);
- Xvoid convert_point_sub(register EdPoint *edp);
- Xvoid allocate_arrays(void);
- Xindex more_faces(uindex new_faces);
- Xindex more_polys(uindex new_polys);
- Xindex more_points(uindex new_poi);
- Xvoid free_arrays(void);
- Xvoid new(void);
- Xvoid start_face(uindex p);
- Xvoid start_poly(uindex p);
- Xvoid start_to_kill_face(uindex p);
- Xvoid start_to_kill_poly(uindex p);
- Xindex select_point(uindex p);
- Xvoid deselect_point(uindex p);
- Xvoid duplicate(char do_faces);
- Xvoid duplicate0(char do_faces);
- Xindex add_point(coord x,
- X coord y,
- X coord z);
- Xindex add_point0(coord x,
- X coord y,
- X coord z);
- Xvoid insert_point(index where,
- X coord x,
- X coord y,
- X coord z);
- Xvoid add_face1(int p0,
- X int p1,
- X int p2);
- Xvoid add_face(uindex p0,
- X uindex p1,
- X uindex p2,
- X short fcol,
- X int silent);
- Xvoid add_face0(uindex p0,
- X uindex p1,
- X uindex p2,
- X short fcol);
- Xvoid insert_face(index where,
- X uindex p0,
- X uindex p1,
- X uindex p2,
- X short fcol);
- Xvoid add_poly(index n,
- X short pcol,
- X index *array,
- X int silent);
- Xvoid allocate_poly(uindex verts,
- X short pcol);
- Xvoid finish_poly(int silent);
- Xvoid insert_poly(index where,
- X index verts,
- X index *array,
- X short col);
- Xvoid delete_point(index p);
- Xvoid delete_point0(index p);
- Xvoid delete_face(register uindex f,
- X int silent);
- Xvoid delete_poly(register uindex q,
- X int silent);
- Xvoid kill_poly(register uindex p);
- Xvoid del_selected_faces(int just_count,
- X index *faces_del,
- X index *polys_del,
- X index *max_verts);
- Xvoid insert_vertex(index q,
- X char vert,
- X index p0,
- X int silent);
- Xvoid delete_vertex(index q,
- X unsigned char vert,
- X int silent);
- Xvoid poly_to_face(index q,
- X int silent);
- Xindex find_nearest_on_screen(pixel pixx,
- X pixel pixy,
- X index avoid_p);
- Xindex find_nearest_in_space(coord fx,
- X coord fy,
- X coord fz,
- X index avoid_p);
- END_OF_FILE
- if test 2920 -ne `wc -c <'eded.p'`; then
- echo shar: \"'eded.p'\" unpacked with wrong size!
- fi
- # end of 'eded.p'
- fi
- if test -f 'edgr.p' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'edgr.p'\"
- else
- echo shar: Extracting \"'edgr.p'\" \(1172 characters\)
- sed "s/^X//" >'edgr.p' <<'END_OF_FILE'
- X/* Prototypes for functions defined in edgr.c */
- Xvoid draw_3d(void);
- Xvoid toggle_dragged_points(void);
- Xvoid add_segment(uindex p);
- Xvoid del_face(index f,
- X int silent);
- Xvoid del_poly(index q,
- X int silent);
- Xvoid kill_segment(uindex p);
- Xvoid distance_tool(char buttons,
- X index current_p);
- Xvoid finish_move(void);
- Xvoid start_moving_point(int buttons,
- X uindex p);
- Xvoid draw_points(char clear);
- Xvoid draw_point(register uindex p,
- X int pcol);
- Xvoid draw_point_sub(EdPoint *p);
- Xvoid draw_hair(void);
- Xvoid draw_distance_tool(void);
- Xvoid redraw_newface(void);
- Xvoid draw_faces(char clear);
- Xvoid draw_face_color(uindex f,
- X int col);
- Xvoid draw_face(uindex f);
- Xvoid draw_poly_color(uindex q,
- X short col);
- Xvoid draw_poly(uindex p);
- Xvoid draw_rot(void);
- Xvoid draw_bars(void);
- Xvoid show_counts(void);
- Xvoid draw_coords(int erase);
- Xvoid draw_distance(void);
- Xvoid box_point(register uindex p);
- Xvoid tri_up_point(register uindex p);
- Xvoid tri_down_point(register uindex p);
- Xvoid clip_draw(register uindex p0,
- X register uindex p1);
- Xvoid screen_say(char *str);
- END_OF_FILE
- if test 1172 -ne `wc -c <'edgr.p'`; then
- echo shar: \"'edgr.p'\" unpacked with wrong size!
- fi
- # end of 'edgr.p'
- fi
- if test -f 'edio.p' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'edio.p'\"
- else
- echo shar: Extracting \"'edio.p'\" \(867 characters\)
- sed "s/^X//" >'edio.p' <<'END_OF_FILE'
- X/* Prototypes for functions defined in edio.c */
- Xvoid handle_gadget(int id);
- Xvoid mouse_down(char buttons);
- Xvoid mouse_up(void);
- Xvoid update_movement(coord newx,
- X coord newy);
- Xvoid handle_key(short key);
- Xvoid handle_menu(int menunum,
- X int itemnum,
- X int flags);
- Xvoid handle_project(int itemnum);
- Xvoid handle_edit(int itemnum,
- X int mflags);
- Xvoid handle_polyhedra(int itemnum);
- Xvoid handle_special(int itemnum);
- Xvoid handle_options(int itemnum,
- X USHORT mflags);
- Xvoid add_all_menus(void);
- Xvoid add_all_gadgets(void);
- Xint save_data(char *fname);
- Xint load_data(char *fname);
- Xvoid get_undo_bufsize(void);
- Xint tell_user_overflow(void);
- Xint tell_user_changes(void);
- Xvoid about_help(void);
- Xvoid save_request(void);
- Xvoid load_request(void);
- Xint save_defaults(void);
- Xint load_defaults(void);
- END_OF_FILE
- if test 867 -ne `wc -c <'edio.p'`; then
- echo shar: \"'edio.p'\" unpacked with wrong size!
- fi
- # end of 'edio.p'
- fi
- if test -f 'edsysdef.h' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'edsysdef.h'\"
- else
- echo shar: Extracting \"'edsysdef.h'\" \(145 characters\)
- sed "s/^X//" >'edsysdef.h' <<'END_OF_FILE'
- X/*
- X edsysdef.h
- X Amiga
- X*/
- X
- X#define PROTOS 1 /* set if compiler supports prototypes */
- X#define DISP_COLOR 1 /* set if there is a color display */
- END_OF_FILE
- if test 145 -ne `wc -c <'edsysdef.h'`; then
- echo shar: \"'edsysdef.h'\" unpacked with wrong size!
- fi
- # end of 'edsysdef.h'
- fi
- if test -f 'edtypes.h' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'edtypes.h'\"
- else
- echo shar: Extracting \"'edtypes.h'\" \(3665 characters\)
- sed "s/^X//" >'edtypes.h' <<'END_OF_FILE'
- X/*
- X edtypes.h
- X types used by ed3
- X
- X09-25-91 add structures for actions
- X09-09-91 add Colors
- X*/
- X
- X#if INTEGER
- X typedef short coord;
- X #define zero 0
- X#else
- X typedef double coord;
- X #define zero 0.0
- X#endif
- X
- Xtypedef short index; /* used to index all arrays */
- X#define POLYFLAG 0x80 /* high bit of index type */
- X
- X/* Lattice won't let me say "unsigned index", so i need: */
- Xtypedef unsigned short uindex;
- Xtypedef short pixel; /* used for all screen coordinates */
- X
- Xtypedef struct /* Describes one 3D point */
- X{
- X coord x, y, z; /* simple as can be */
- X} Point3D;
- X
- Xtypedef struct /* Describes one 3D vector */
- X{
- X coord x, y, z;
- X} Vector3D;
- X
- Xtypedef struct /* Describes one point used by the editor */
- X{
- X coord x, y, z; /* in global 3D space */
- X pixel px, py; /* on the screen */
- X short code; /* clipping codes and flags */
- X} EdPoint;
- X
- Xtypedef struct /* Describes one face */
- X{
- X uindex p[3]; /* three points the face connects */
- X unsigned short color;
- X} Face;
- X
- Xtypedef struct /* Describes one multi-sided polygon, >3 sides */
- X{
- X uindex *p; /* pointer to start of point array */
- X unsigned short verts; /* number of vertices */
- X unsigned short color;
- X} Polygon;
- X
- Xtypedef struct
- X{
- X short attached; /* flag: attached to a point or not? */
- X uindex p; /* which point it is attached to */
- X coord x, y, z; /* endpoint if not attached */
- X} EndPoint;
- X
- Xtypedef struct
- X{
- X unsigned short offset;
- X unsigned short actions;
- X} Operation;
- X
- Xtypedef struct
- X{
- X char type;
- X coord x, y, z;
- X} a_add_p;
- X
- Xtypedef struct
- X{
- X char type;
- X coord x, y, z;
- X index number;
- X} a_del_p;
- X
- Xtypedef struct
- X{
- X char type;
- X short color;
- X index p0, p1, p2;
- X} a_add_f;
- X
- Xtypedef struct
- X{
- X char type;
- X short color;
- X index p0, p1, p2;
- X index number;
- X} a_del_f;
- X
- Xtypedef struct
- X{
- X char type;
- X char points;
- X short color;
- X index p[MAX_EDGES];
- X} a_add_q;
- X
- Xtypedef struct
- X{
- X char type;
- X char points;
- X index number;
- X short color;
- X index p[MAX_EDGES];
- X} a_del_q;
- X
- X#define MAX_ACTION_SIZE sizeof(a_del_q) /* the largest structure */
- X
- Xtypedef struct
- X{
- X char type;
- X index p0;
- X coord dx, dy, dz;
- X} a_move_p;
- X
- Xtypedef struct
- X{
- X char type;
- X char changes;
- X index p0, p1;
- X index changed[MAX_EDGES]; /* each entry may e a flag or poly */
- X /* polys are flagged with the POLYFLAG bit set */
- X} a_join_p;
- X
- Xtypedef struct
- X{
- X char type;
- X char vert; /* index, not number of verts */
- X index q; /* poly */
- X index p0; /* point # removed */
- X} a_del_v;
- X
- Xtypedef struct
- X{
- X char type;
- X index q; /* poly */
- X} a_morph_q;
- X
- Xunion Action
- X{
- X a_add_p add_p;
- X a_del_p del_p;
- X a_add_f add_f;
- X a_del_f del_f;
- X a_add_q add_q;
- X a_del_q del_q;
- X a_move_p move_p;
- X};
- X
- Xtypedef struct
- X{
- X char assume_poly; /* Tells the geometric operators to assume we are
- X working with a polyhedron */
- X char copy_made;
- X char crosshair; /* display crosshair? */
- X char debug;
- X char display_dtool;
- X char display_type; /* appear on workbench? etc. */
- X char drag_dtool; /* set when we are actively dragging the dtool */
- X char exclusive_del; /* delete only the faces which have ALL points selected */
- X char faces_only; /* Edit operations apply to faces/polys only */
- X char in_edit_area; /* set when the pointer is in the editing area */
- X char moving_points;
- X char points_only; /* Edit operations apply to points only */
- X char rotate_all; /* Rotate will affect ALL points */
- X char shape; /* either M_FACE or M_POLY */
- X char show_coords; /* display coordinates? */
- X char which_end; /* which end of the dtool are we dragging? */
- X char undo_active; /* set if the undo buffer is active */
- X} Flags;
- X
- X/* to remember the colors of various display elements */
- X
- Xtypedef struct
- X{
- X char titlea;
- X char titleb;
- X char box;
- X char point;
- X char face;
- X char erase;
- X char newface;
- X} Colors;
- X
- X
- END_OF_FILE
- if test 3665 -ne `wc -c <'edtypes.h'`; then
- echo shar: \"'edtypes.h'\" unpacked with wrong size!
- fi
- # end of 'edtypes.h'
- fi
- if test -f 'edvan.p' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'edvan.p'\"
- else
- echo shar: Extracting \"'edvan.p'\" \(2290 characters\)
- sed "s/^X//" >'edvan.p' <<'END_OF_FILE'
- X/* Prototypes for functions defined in edvan.c */
- Xvoid center_to_origin(void);
- Xvoid reset_zoom(void);
- Xvoid move_point_rel(index p,
- X coord dx,
- X coord dy,
- X coord dz);
- Xvoid move_point_to(index p,
- X coord x,
- X coord y,
- X coord z);
- Xvoid refresh_all(void);
- Xvoid toggle_dtool(void);
- Xvoid select_all(void);
- Xvoid deselect_all(void);
- Xvoid select_connected(index starting_point);
- Xvoid deselect_connected(index starting_point);
- Xvoid toggle_select(int buttons,
- X index tp);
- Xvoid glue(index nearest);
- Xvoid glue_points(int p0,
- X int p1);
- Xvoid unfold(void);
- Xvoid stellate(void);
- Xvoid stellate0(int stellar_mag,
- X int rel_to);
- Xvoid find_dual(void);
- Xint dual_ok(void);
- Xindex adjacent_xx(uindex qf0,
- X uindex qf1,
- X int poly_flag0,
- X int poly_flag1);
- Xindex adjacent_ff(uindex f0,
- X uindex f1);
- Xindex adjacent_fp(uindex f0,
- X uindex q0);
- Xindex adjacent_pp(uindex q0,
- X uindex q1);
- Xindex points_are_a_face(uindex ps0,
- X uindex ps1,
- X uindex ps2);
- Xindex face_next_to_edge(uindex ps0,
- X uindex ps1,
- X index avoid_f);
- Xindex point_is_on_a_face(uindex ps0);
- Xindex point_is_on_a_poly(uindex ps0);
- Xindex points_are_on_a_poly(uindex *array,
- X uindex verts);
- Xindex poly_next_to_edge(uindex ps0,
- X uindex ps1,
- X index avoid_p);
- Xvoid zoom(int buttons);
- Xvoid set_rot_axis(coord x,
- X coord y,
- X coord z);
- Xvoid rotate(void);
- Xvoid rotate_point(index p,
- X double co,
- X double si);
- Xvoid find_center(double *cx,
- X double *cy,
- X double *cz);
- Xvoid find_radius(double cx,
- X double cy,
- X double cz,
- X double *radius);
- Xunsigned long isqrt(unsigned long v);
- Xint fibo(int n);
- Xvoid set_clockwisdom(void);
- Xint determine_clockwisdom(index p0,
- X index p1,
- X index p2);
- Xvoid change_face_clockwisdom(index f);
- Xvoid change_poly_clockwisdom(index q);
- END_OF_FILE
- if test 2290 -ne `wc -c <'edvan.p'`; then
- echo shar: \"'edvan.p'\" unpacked with wrong size!
- fi
- # end of 'edvan.p'
- fi
- if test -f 'freq.p' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'freq.p'\"
- else
- echo shar: Extracting \"'freq.p'\" \(104 characters\)
- sed "s/^X//" >'freq.p' <<'END_OF_FILE'
- X/* Prototypes for functions defined in freq.c */
- Xvoid frequency(void);
- Xint bucky_frequency(short freq);
- END_OF_FILE
- if test 104 -ne `wc -c <'freq.p'`; then
- echo shar: \"'freq.p'\" unpacked with wrong size!
- fi
- # end of 'freq.p'
- fi
- if test -f 'sysdefed.h' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'sysdefed.h'\"
- else
- echo shar: Extracting \"'sysdefed.h'\" \(146 characters\)
- sed "s/^X//" >'sysdefed.h' <<'END_OF_FILE'
- X/*
- X sysdefed.h
- X Amiga
- X*/
- X
- X#define PROTOS 1 /* set if compiler supports prototypes */
- X#define DISP_COLOR 1 /* set if there is a color display */
- X
- END_OF_FILE
- if test 146 -ne `wc -c <'sysdefed.h'`; then
- echo shar: \"'sysdefed.h'\" unpacked with wrong size!
- fi
- # end of 'sysdefed.h'
- fi
- if test -f 'sysgr.h' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'sysgr.h'\"
- else
- echo shar: Extracting \"'sysgr.h'\" \(815 characters\)
- sed "s/^X//" >'sysgr.h' <<'END_OF_FILE'
- X/* includes for an ed3 module that uses the graphics library */
- X
- X#include <exec/types.h>
- X#include <graphics/gfxmacros.h>
- X#include <graphics/rastport.h>
- X
- X#ifdef LATTICE
- X#include <proto/graphics.h>
- X#else
- X#include <functions.h>
- X#define PI 3.14159265358979323846
- X#define PID2 1.57079632679489661923 /* PI/2 */
- X#define PID4 0.78539816339744830962 /* PI/4 */
- X#endif
- X
- X#include <stdio.h>
- X#include <math.h>
- X
- X#include "ed3.h" /* funtion defs, #defines, typedefs */
- Xextern struct RastPort *rp;
- X
- X#define m_move(x, y) Move(rp, x, y)
- X#define m_draw(x, y) Draw(rp, x, y)
- X#define m_setpen1(c) SetAPen(rp, c)
- X#define m_setpen2(c) SetBPen(rp, c)
- X#define m_setmode(m) SetDrMd(rp, m)
- X#define m_text(t, l) Text(rp, t, l)
- X#define m_rectfill(x0, y0, x1, y1) RectFill(rp, x0, y0, x1, y1)
- X
- X#define dm_norm JAM2
- X#define dm_comp COMPLEMENT
- END_OF_FILE
- if test 815 -ne `wc -c <'sysgr.h'`; then
- echo shar: \"'sysgr.h'\" unpacked with wrong size!
- fi
- # end of 'sysgr.h'
- fi
- if test -f 'sysgr.p' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'sysgr.p'\"
- else
- echo shar: Extracting \"'sysgr.p'\" \(2088 characters\)
- sed "s/^X//" >'sysgr.p' <<'END_OF_FILE'
- X/* Prototypes for functions defined in sysgr.c */
- Xvoid open_stuff(short depth,
- X char *title);
- Xvoid setup_for_workbench(struct Screen *wbdata);
- Xvoid setup_for_custom_screen(int depth,
- X char *title);
- Xvoid sys_attach_menus(void);
- Xvoid sys_refresh_gadgets(void);
- Xvoid add_gadget(char *string,
- X int gflags);
- Xvoid add_boolean_gadget(struct Window *wind,
- X int x,
- X int y,
- X int width,
- X char *string,
- X int gflags,
- X int id,
- X int draw);
- Xvoid add_long_gadget(struct Window *wind,
- X int x,
- X int y,
- X int width,
- X long value,
- X int id,
- X int draw);
- Xstruct Border *create_shadow_border(int width,
- X int height,
- X int inside);
- Xvoid add_menu(char *name);
- Xstruct MenuItem *add_menu_item(int menu_num,
- X char *name,
- X int mflags,
- X char shortcut);
- Xvoid toggle_menuitem(int which_menu,
- X int which_item);
- Xvoid sys_exit(char *s);
- Xvoid enable_menus(char on);
- Xvoid wait_for_message(void);
- Xvoid handle_messages(void);
- Xvoid sys_handle_menu(unsigned short menu_number);
- Xvoid *sys_alloc(unsigned int size);
- Xvoid sys_free(void *ptr,
- X unsigned int size);
- Xchar *sys_file_requestor(char *title,
- X char *showpattern);
- Xvoid sys_window(int cols,
- X int rows,
- X char *title);
- Xvoid sys_close_window(void);
- Xvoid sys_say_text(char *str);
- Xvoid sys_get_long(long value,
- X int id);
- Xvoid sys_boolean(char *string,
- X int id);
- Xvoid sys_activate(int id);
- Xvoid sys_movecur(int col,
- X int row);
- Xint sys_read_event(int *id,
- X long *data);
- Xvoid *mem_alloc(long bytes);
- Xvoid clear_remember(int to_where);
- END_OF_FILE
- if test 2088 -ne `wc -c <'sysgr.p'`; then
- echo shar: \"'sysgr.p'\" unpacked with wrong size!
- fi
- # end of 'sysgr.p'
- fi
- if test -f 'sysnogr.h' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'sysnogr.h'\"
- else
- echo shar: Extracting \"'sysnogr.h'\" \(369 characters\)
- sed "s/^X//" >'sysnogr.h' <<'END_OF_FILE'
- X/* includes for an ed3 module that don't use the graphics library */
- X
- X#include <exec/types.h>
- X#include <exec/memory.h>
- X#include <stdio.h>
- X
- X#ifdef LATTICE
- X#include <math.h>
- X#else
- X#include <math.h>
- X#define PI 3.14159265358979323846
- X#define PID2 1.57079632679489661923 /* PI/2 */
- X#define PID4 0.78539816339744830962 /* PI/4 */
- X#endif
- X
- X#define HELPKEY
- X
- X#include "ed3.h"
- END_OF_FILE
- if test 369 -ne `wc -c <'sysnogr.h'`; then
- echo shar: \"'sysnogr.h'\" unpacked with wrong size!
- fi
- # end of 'sysnogr.h'
- fi
- if test -f 'undo.p' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'undo.p'\"
- else
- echo shar: Extracting \"'undo.p'\" \(1453 characters\)
- sed "s/^X//" >'undo.p' <<'END_OF_FILE'
- X/* Prototypes for functions defined in undo.c */
- Xint enough_room(index p,
- X index f,
- X index q,
- X index dp,
- X index df,
- X index dq,
- X index mp,
- X int max_verts);
- Xvoid undo(void);
- Xvoid undo_action(unsigned short offset);
- Xvoid change_facet(index p0,
- X index p1,
- X index i1);
- Xvoid redo(void);
- Xvoid redo_action(unsigned short offset);
- Xunsigned short size_of_action(unsigned short offset);
- Xvoid action_add_p(coord x,
- X coord y,
- X coord z);
- Xvoid action_del_p(index p,
- X coord x,
- X coord y,
- X coord z);
- Xvoid action_add_f(index p0,
- X index p1,
- X index p2,
- X int col);
- Xvoid action_del_f(index f);
- Xvoid action_add_q(int points,
- X index *p,
- X int col);
- Xvoid action_del_q(index q);
- Xvoid action_move_p(index p,
- X coord dx,
- X coord dy,
- X coord dz);
- Xvoid action_join_p(index p0,
- X index p1,
- X index *changed,
- X index changes);
- Xvoid action_del_v(index q,
- X char vert,
- X index p0);
- Xvoid action_morph_q(index q);
- Xvoid make_room(void);
- Xvoid delete_oldest_operation(void);
- Xvoid init_undo(void);
- Xvoid begin_operation(void);
- Xvoid end_operation(void);
- END_OF_FILE
- if test 1453 -ne `wc -c <'undo.p'`; then
- echo shar: \"'undo.p'\" unpacked with wrong size!
- fi
- # end of 'undo.p'
- fi
- echo shar: End of archive 1 \(of 6\).
- cp /dev/null ark1isdone
- MISSING=""
- for I in 1 2 3 4 5 6 ; do
- if test ! -f ark${I}isdone ; then
- MISSING="${MISSING} ${I}"
- fi
- done
- if test "${MISSING}" = "" ; then
- echo You have unpacked all 6 archives.
- rm -f ark[1-9]isdone
- else
- echo You still need to unpack the following archives:
- echo " " ${MISSING}
- fi
- ## End of shell archive.
- exit 0
- --
- Mail submissions (sources or binaries) to <amiga@uunet.uu.net>.
- Mail comments to the moderator at <amiga-request@uunet.uu.net>.
- Post requests for sources, and general discussion to comp.sys.amiga.misc.
-